import axios from 'axios';

export function getRasterValue(x: number, y: number,url:string, params: any) {
  const offset = 0.00001;
  return axios.get(url, {
    params: {
      ...params,
      QUERY_LAYERS: params.LAYERS,
      REQUEST: 'GetFeatureInfo',
      STYLES: '',
      INFO_FORMAT: 'application/json',
      FEATURE_COUNT: '50',
      X: '50',
      Y: '50',
      SRS: params.CRS,
      BBOX: `${x - offset},${y - offset},${x + offset},${y + offset}`,
    },
  });
}

export default {
  getRasterValue,
};
